/*
 * GNU GENERAL PUBLIC LICENSE v2
 * 
 * Developers: Alan Audette, Oguz Bastemur
 */
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace SqlDatabaseBackup.Configuration
{
    public class Databases : ConfigurationElementCollection
    {
        public Database this[int index]
        {
            get
            {
                return base.BaseGet(index) as Database;
            }
            set
            {
                if (base.BaseGet(index) != null)
                    base.BaseRemoveAt(index);

                this.BaseAdd(index, value);
            }
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new Database();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((Database)element).Name;
        }
    }

    public class Database : ConfigurationElement
    {
        [ConfigurationProperty("name")]
        public string Name
        {
            get { return this["name"] as string; }
        }
    }
}
